# Copyright (c) 2025, EAM Team and contributors
# For license information, please see license.txt

import frappe
from frappe.model.document import Document


class EquipmentCategory(Document):
    def validate(self):
        """验证数据"""
        if not self.code_prefix:
            # 如果没有设置代码前缀，使用分类名称的首字母
            self.code_prefix = "".join([word[0].upper() for word in self.category_name.split()[:2]])